﻿using System;
using System.ComponentModel;
using System.Drawing;
using System.IO;
using System.Windows.Forms;
using YArchitech.DataModel;
using YArchitech.LIB;

namespace YArchitech.Plumbing
{
	public partial class FormTPipeconnectRPipe : System.Windows.Forms.Form
	{
		public FormTPipeconnectRPipe()
		{
			this.InitializeComponent();
			new YJKProcessTools().ShowInTaskbarChange(this);
			base.Icon = Resource.YArchitechIcon;
		}

		private Image getImage(string me)
		{
			this.path = Path.Combine(Product.ResLocation, me + ".png");
			return Image.FromFile(this.path);
		}

		private void FormTPipeconnectRPipe_Load(object sender, EventArgs e)
		{
			new ToolTip().SetToolTip(this.button1, "立管为基准管，横管与立管对齐。");
			new ToolTip().SetToolTip(this.button2, "横管为基准管，立管与横管对齐。");
			new ToolTip().SetToolTip(this.button3, "直径大的为基准管，相等时横管为基准管。");
			new ToolTip().SetToolTip(this.button4, "不做对齐操作直接连接。");
			this.button1.BackgroundImage = this.getImage("TPCRPLG");
			this.button2.BackgroundImage = this.getImage("TPCRPHG");
			this.button3.BackgroundImage = this.getImage("TPCRPZJ");
			this.button4.BackgroundImage = this.getImage("TPCRPNO");
			string trpipeConnectText = this.userSetting.GetTRPipeConnectText();
			if (trpipeConnectText == "立管为基准管，横管与立管对齐。")
			{
				this.button1.Focus();
				this.button1.TabStop = true;
			}
			else if (trpipeConnectText == "横管为基准管，立管与横管对齐。")
			{
				this.button2.Focus();
				this.button2.TabStop = true;
			}
			else if (trpipeConnectText == "直径大的为基准管，相等时横管为基准管。")
			{
				this.button3.Focus();
				this.button3.TabStop = true;
			}
			else if (trpipeConnectText == "不做对齐操作直接连接。")
			{
				this.button4.Focus();
				this.button4.TabStop = true;
			}
			this.message = trpipeConnectText;
		}

		private void FormTPipeconnectRPipe_Deactivate(object sender, EventArgs e)
		{
			if (this.message != "")
			{
				string text = this.message;
				this.userSetting.WriteTRPipeConnectText(text);
			}
		}

		private void button1_Click(object sender, EventArgs e)
		{
			this.message = "立管为基准管，横管与立管对齐。";
		}

		private void button2_Click(object sender, EventArgs e)
		{
			this.message = "横管为基准管，立管与横管对齐。";
		}

		private void button3_Click(object sender, EventArgs e)
		{
			this.message = "直径大的为基准管，相等时横管为基准管。";
		}

		private void button4_Click(object sender, EventArgs e)
		{
			this.message = "不做对齐操作直接连接。";
		}

		private void FormTPipeconnectRPipe_MouseEnter(object sender, EventArgs e)
		{
			base.Focus();
		}

		private void label2_Click(object sender, EventArgs e)
		{
		}

		private void button5_Click(object sender, EventArgs e)
		{
			if (this.button5.Text == "︾︾")
			{
				this.button5.Text = "︽︽";
				base.Size = new Size(386, 183);
				return;
			}
			if (this.button5.Text == "︽︽")
			{
				this.button5.Text = "︾︾";
				base.Size = new Size(386, 121);
			}
		}

		private void label1_Click(object sender, EventArgs e)
		{
		}

		public HVACUserSetting userSetting = new HVACUserSetting();

		public string message = "";

		private string path = "";
	}
}
